package com.betting.entity;

public enum BetResultStatus {
    WIN("WIN"),
    LOSE("LOSE"),
    HALF_WIN("HALF_WIN"),
    HALF_LOSE("HALF_LOSE"),
    DRAW("DRAW"),
    PENDING("PENDING");

    private final String value;

    BetResultStatus(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public boolean isWin() {
        return this == WIN || this == HALF_WIN;
    }

    public boolean isLose() {
        return this == LOSE || this == HALF_LOSE;
    }

    public double getProfitMultiplier() {
        switch (this) {
            case WIN:
                return 1.0;
            case HALF_WIN:
                return 0.5;
            case DRAW:
                return 0.0;
            case HALF_LOSE:
                return -0.5;
            case LOSE:
                return -1.0;
            default:
                return 0.0;
        }
    }

    public static BetResultStatus fromValue(String value) {
        for (BetResultStatus status : BetResultStatus.values()) {
            if (status.value.equalsIgnoreCase(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid BetResultStatus value: " + value);
    }
} 